import rclpy
from rclpy.node import Node
from base_interface_demo01.msg import Stu
class TalkerStu(Node):
    def __init__(self):
        super().__init__('talker_stu_node_py')
        
        self.get_logger().info('发布发创建py')
        self.publisher_=self.create_publisher(Stu,'chatter_stu',10)
        # # 秒为单位
        self.timerer_=self.create_timer(1.0,self.on_timer)
        self.age=0
    def on_timer(self):
        stu=Stu()
        stu.name='xiaoming'
        stu.age=self.age
        self.age+=1
        stu.height=165.25
        self.publisher_.publish(stu)
        self.get_logger().info(f'发布py 发送 name={stu.name},age={stu.age},height={stu.height}')
        pass
def main():
    rclpy.init()
    rclpy.spin(TalkerStu())
    rclpy.shutdown()



if __name__=='__main__':
    main